package com.byteshake.common

import android.app.Application
import android.content.Context
import com.byteshake.common.base.AppContextAgent
import com.byteshake.common.utils.LogUtil

object BaseAppContext : AppContextAgent {

    private var agent: AppContextAgent? = null

    fun init(agent: AppContextAgent){
        LogUtil.d("init BaseAppContext this.agent = " + this.agent)
        if (this.agent == null){
            this.agent = agent
            LogUtil.initLog()
        }

    }

    override fun getContext(): Context = agent!!.getContext()

    override fun getApplication(): Application = agent!!.getApplication()

    fun getPackageName():String = getContext().packageName
}